<template>
    <div>
      <span>正则表达式语法</span>
      <el-card>
        /正则表达式主体/修饰符(可选)
      </el-card>
      <div>
        <el-button @click="regexp">测试</el-button>
      </div>
    </div>
</template>

<script>
export default {
  name: 'RegExp',
  methods: {
    regexp () {
      let pattern = /exp/i
      let str = 'exp cc exp'
      console.log(str.search(pattern))
      console.log(str.replace(pattern, 'xxx'))
      console.log(pattern.test(str))
      console.log(pattern.exec(str))
    }
  }
}
</script>

<style scoped>

</style>
